<template>
  <div>
    <el-row>
      <el-col :span="12">
        最新消息
        <el-table
            :data="newsList"
            :highlight-current-row="true"
            border
            current-row-key="newsId"
            stripe
            style="width: 100%"
        >
          <el-table-column align="center"
          >
            <template v-slot="scope">
              <a style="color: coral;cursor: pointer" @click="showInfo(scope.row)">{{ scope.row.newsTitle }}</a>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="12">
        产品动态
        <el-table
            :data="dailyList"
            :highlight-current-row="true"
            border
            current-row-key="newsId"
            stripe
            style="width: 100%"
        >
          <el-table-column align="center"
          >
            <template v-slot="scope">
              <a style="color: coral;cursor: pointer" @click="showInfo(scope.row)">{{ scope.row.newsTitle }}</a>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        高端访谈
        <el-table
            :data="interviewList"
            :highlight-current-row="true"
            border
            current-row-key="newsId"
            stripe
            style="width: 100%"
        >
          <el-table-column align="center"
          >
            <template v-slot="scope">
              <a style="color: coral;cursor: pointer" @click="showInfo(scope.row)">{{ scope.row.newsTitle }}</a>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="12">
        技术信息
        <el-table
            :data="technologyList"
            :highlight-current-row="true"
            border
            current-row-key="newsId"
            stripe
            style="width: 100%"
        >
          <el-table-column align="center"
          >
            <template v-slot="scope">
              <a style="color: coral;cursor: pointer" @click="showInfo(scope.row)">{{ scope.row.newsTitle }}</a>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "u_news",
  data() {
    return {
      newsList: [],
      dailyList: [],
      interviewList: [],
      technologyList: [],

    }
  },
  created() {
    this.getAll();
  },
  methods: {
    getAll() {
      this.axios
          .get("/news/page/1/10?newsType=新闻")
          .then(res => {
            this.newsList = res.data.data.records;
          })
      this.axios
          .get("/news/page/1/10/?newsType=动态")
          .then(res => {
            this.dailyList = res.data.data.records;
          })
      this.axios
          .get("/news/page/1/10/?newsType=访谈")
          .then(res => {
            this.interviewList = res.data.data.records;

          })
      this.axios
          .get("/news/page/1/10/?newsType=技术")
          .then(res => {
            this.technologyList = res.data.data.records;

          })

    },
    showInfo(row) {
      console.log(row.newsId)
      this.$router.push({
        path: "/user_index/u_showInfo",
        query: {
          newsId: row.newsId,
        }
      })

    }
  }
}
</script>

<style scoped>

</style>